
package com.example.user.coolrun.runnershign;

import java.util.Vector;

import javax.microedition.khronos.opengles.GL10;

/*
  Group is a mesh with no mesh data itself but can contain one or more other meshes.组是一个网格本身没有网格数据，但可以包含一个或多个其他网格。

 */
public class Group extends Mesh {
	private final Vector<Mesh> mChildren = new Vector<Mesh>();

	@Override
	public void draw(GL10 gl) {
		if (!shouldBeDrawn) return;
		
		int size = mChildren.size();
		gl.glPushMatrix();
		gl.glTranslatef(x, y, z);
		gl.glRotatef(rx, 1, 0, 0);
		gl.glRotatef(ry, 0, 1, 0);
		gl.glRotatef(rz, 0, 0, 1);

		for (int i = 0; i < size; i++) {
			mChildren.get(i).draw(gl);
		}
			
		gl.glPopMatrix();
	}

	public boolean add(Mesh object) {
		return mChildren.add(object);
	}

	public boolean remove(Object object) {
		return mChildren.remove(object);
	}



}
